# $Id: PKGBUILD 175949 2013-01-25 09:52:43Z andyrtr $
# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Contributor: Armin Luntzer
# Original opennx PKGBUILD: Tomas Groth tomasgroth.at.yahoo.dk

pkgname=opennx
pkgver=0.16.0.725
pkgrel=1
pkgdesc="A GPL replacement for the NoMachine client, patched to always show the session chooser"
url="http://opennx.sf.net/"
arch=('i686' 'x86_64')
license=('GPL')
depends=('wxgtk' 'libcups' 'libxext' 'libxft' 'xorg-xauth' 'curl' 'nx-common')
makedepends=('zip' 'opensc' 'libpulse' 'smbclient' 'libusb-compat')
#optdepends=('cups: for full local printing support')
source=(http://downloads.sourceforge.net/project/opennx/opennx/CI-source/opennx-$pkgver.tar.gz)
md5sums=('6bfe389638ac9c14fa89ca56b0c671b6')

build() {
  cd $srcdir/opennx*
  ./configure --prefix=/usr \
    --enable-usbip
  make
}

package() {
  cd $srcdir/opennx*
  make DESTDIR=${pkgdir} install
  make DESTDIR=${pkgdir} install-man
  
  # fix some file locations
  install -dm755 ${pkgdir}/usr/share/applications
  cp -aR ${pkgdir}/usr/share/applnk/xdg/* ${pkgdir}/usr/share/applications
  rm -rf ${pkgdir}/usr/share/applnk
  
  sed -i -e "s:Exec=/usr/NX/bin/opennx:Exec=/usr/bin/opennx:" ${pkgdir}/usr/share/applications/*.desktop
}
